<template>
  <div class="home">
    <h1>This is an home</h1>
    <p>{{message}}</p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'HomeView',
  metaInfo: {
      title: '我是index页面的title',
      meta: [
        {
          name: 'keywords',
          content: '我是index页面的keywords'
        },
        {
          name: 'description',
          content: '我是index页面的description'
        }
      ]
  },
  components: {
  },
  data () {
    return {
      message: ''
    }
  },
  async created () {
    try {
      axios.get('https://jsonplaceholder.typicode.com/posts/3')
      .then(response => {
        console.log(response.data.title)
        this.message = '首页' + response.data.title
      })
      .catch(error => {
        console.log(111, error.message)
        this.message = error.message
      })
    } catch (error) {
      console.log('test2', error)
    }
  }
}
</script>
